package com.practice.misc;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Min10 {
	public final static void main(String[] args) {
		new Min10().run();
	}
	
	private void run() {
		try {
			BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
			int N = read(f);
			long[][] a = new long[N][N];
			for (int i=0; i<N; i++) a[i] = read(f, N);
			Solution m2 = new Solution();
			m2.solve(N, a, 2);		
			Solution m5 = new Solution();
			m5.solve(N, a, 5);
			
			if (m2.min < m5.min) {
				m2.print();
			}
			else {
				m5.print();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public int read(BufferedReader f) throws IOException {
		return Integer.parseInt(f.readLine());
	}
	
	public long[] read(BufferedReader f, int N) throws IOException {
		String[] t = f.readLine().split(" ");
		long[] a = new long[N];
		for (int i=0; i<N; i++) {
			a[i] = Long.parseLong(t[i]);
		}
		return a;
	}
	
	private class Solution {
		private final static boolean 	HORZ = false;
		private final static boolean 	VERT = true;
		
		int 		N; 
		int 		min;
		boolean[][] route;
		
		boolean 	has0;
		int			x0 = 0;
		int 		y0 = 0;
		
		public void solve(int N, long[][] a, int k) {
			int[][] m = new int[N][N];
			this.N = N;
			route = new boolean[N][N];
			for (int i=0; i<N; i++) {
				for (int j=0; j<N; j++) {
					int t = 0;
					if (a[i][j] == 0) {
						t = 1;
						has0 = true;
						x0 = i;
						y0 = j;
					}
					else {
						t = calc(a[i][j], k);
					}
					
					if (i == 0 && j == 0) {
						m[i][j] = t;
					}
					else if (j == 0 || (i>0 && j>0 && m[i][j-1] >= m[i-1][j])) {
						m[i][j] = m[i-1][j] + t;
						route[i][j] = VERT;
					}
					else {
						m[i][j] = m[i][j-1] + t;
					}
				}
			}
			
			if (m[N-1][N-1] > 1 && has0) {
				this.min = 1;
				for (int i=1; i<=x0; i++) route[i][0] = VERT;
				for (int i=1; i<=y0; i++) route[x0][i] = HORZ;
				for (int i=x0+1; i<N; i++) route[i][y0] = VERT;
				for (int i=y0+1; i<N; i++) route[N-1][i] = HORZ;
			}
			else {
				this.min = m[N-1][N-1];
			}
		}
		
		private int calc(long a, int k) {
			int i=0;
			for (; a%k==0; i++) a/=k;
			return i;
		}
		
		public void print() {
			System.out.println(min);
			int x = N-1, y = N-1;
			StringBuilder sb = new StringBuilder();
			while (x>0 || y>0) {
				if (!route[x][y]) {			// horizontal
					sb.insert(0, 'R');
					y--;
				}
				else {						// vertical
					sb.insert(0, 'D');
					x--;
				}
			}
			System.out.println(sb.toString());
		}
	}
}
